package com.aspose.cells;

class zme {
   private double a;
   private double b;
   private String c = "i";

   public double a() {
      return this.a;
   }

   public double b() {
      return this.b;
   }

   public zme() {
      this.a = 0.0D;
      this.b = 0.0D;
      this.c = "i";
   }

   public zme(double var1, double var3) {
      this.a = var1;
      this.b = var3;
      this.c = "i";
   }

   public zme(double var1, double var3, String var5) {
      this.a = var1;
      this.b = var3;
      this.c = var5;
   }

   public zme(String var1) {
      String var2 = this.a(var1);
      this.c = this.b(var1);
      this.a(var1, var2, this.c);
   }

   private String a(String var1) {
      int var2 = var1.indexOf("-");
      if (var1.indexOf("+") != -1) {
         return "+";
      } else {
         return var2 != -1 && var2 != 0 ? "-" : "";
      }
   }

   private String b(String var1) {
      if (var1.indexOf("i") != -1) {
         return "i";
      } else {
         return var1.indexOf("j") != -1 ? "j" : "";
      }
   }

   private void a(String var1, String var2, String var3) {
      boolean var4 = false;
      int var5 = var1.length();
      String var6;
      if (var2.length() == 0) {
         if (var3.length() == 0) {
            this.a = com.aspose.cells.b.a.zn.a(var1);
         } else {
            var6 = var1.substring(0, 0 + (var5 - 1));
            if (var6.equals("-")) {
               this.b = -1.0D;
            } else if (var6.length() == 0) {
               this.b = 1.0D;
            } else {
               this.b = com.aspose.cells.b.a.zn.a(var6);
            }
         }
      } else {
         int var8 = var1.indexOf(var2);
         var5 = var1.length();
         var6 = var1.substring(0, 0 + var8);
         String var7 = var1.substring(var8 + 1, var8 + 1 + (var5 - var8 - 2));
         if (var7.length() == 0) {
            var7 = "1";
         }

         var6 = var6.trim();
         var7 = var7.trim();
         if (var6.length() != 0) {
            this.a = com.aspose.cells.b.a.zn.a(var6);
         }

         if (var2.equals("-")) {
            this.b = -com.aspose.cells.b.a.zn.a(var7);
         } else {
            this.b = com.aspose.cells.b.a.zn.a(var7);
         }
      }

   }

   public String toString() {
      String var1;
      if (this.a != 0.0D) {
         if (this.b > 0.0D) {
            if (this.b == 1.0D) {
               var1 = com.aspose.cells.b.a.zn.b(this.a) + "+" + this.c;
            } else {
               var1 = com.aspose.cells.b.a.zn.b(this.a) + "+" + com.aspose.cells.b.a.zn.b(this.b) + this.c;
            }
         } else if (this.b < 0.0D) {
            if (this.b == -1.0D) {
               var1 = com.aspose.cells.b.a.zn.b(this.a) + "-" + this.c;
            } else {
               double var2 = -1.0D * this.b;
               var1 = com.aspose.cells.b.a.zn.b(this.a) + "-" + com.aspose.cells.b.a.zn.b(var2) + this.c;
            }
         } else {
            var1 = com.aspose.cells.b.a.zn.b(this.a);
         }
      } else if (this.b == 0.0D) {
         var1 = com.aspose.cells.b.a.zn.b(this.a);
      } else if (this.b == -1.0D) {
         var1 = "-" + this.c;
      } else if (this.b == 1.0D) {
         var1 = this.c;
      } else {
         var1 = com.aspose.cells.b.a.zn.b(this.b) + this.c;
      }

      return var1;
   }

   public zme a(zme var1) {
      double var2 = this.a + var1.a;
      double var4 = this.b + var1.b;
      String var6 = "i";
      if (var1.c.equals("j") || this.c.equals("j")) {
         var6 = "j";
      }

      return new zme(var2, var4, var6);
   }

   public zme b(zme var1) {
      double var2 = this.a - var1.a;
      double var4 = this.b - var1.b;
      String var6 = "i";
      if (var1.c.equals("j") || this.c.equals("j")) {
         var6 = "j";
      }

      return new zme(var2, var4, var6);
   }

   public zme c(zme var1) {
      double var2 = this.a * var1.a - this.b * var1.b;
      double var4 = this.a * var1.b + this.b * var1.a;
      String var6 = "i";
      if (var1.c.equals("j") || this.c.equals("j")) {
         var6 = "j";
      }

      return new zme(var2, var4, var6);
   }

   public zme d(zme var1) {
      double var2 = 0.0D;
      double var4 = 0.0D;
      double var6 = 0.0D;
      var2 = this.a * var1.a + this.b * var1.b;
      var4 = this.b * var1.a - this.a * var1.b;
      var6 = var1.a * var1.a + var1.b * var1.b;
      double var8 = var2 / var6;
      double var10 = var4 / var6;
      String var12 = "i";
      if (var1.c.equals("j") || this.c.equals("j")) {
         var12 = "j";
      }

      return new zme(var8, var10, var12);
   }

   public double c() {
      return Math.sqrt(this.a * this.a + this.b * this.b);
   }

   public zme d() {
      double var1 = Math.log(Math.sqrt(this.a * this.a + this.b * this.b));
      return new zme(var1, Math.atan2(this.b, this.a), this.c);
   }

   public zme e() {
      double var1 = Math.sqrt(this.a * this.a + this.b * this.b);
      double var3 = Math.atan2(this.b, this.a);
      if (this.c.length() == 0) {
         this.c = "i";
      }

      return new zme(Math.sqrt(var1) * Math.cos(var3 / 2.0D), Math.sqrt(var1) * Math.sin(var3 / 2.0D), this.c);
   }

   public zme f() {
      if (this.c.length() == 0) {
         this.c = "i";
      }

      return new zme(Math.sin(this.a) * Math.cosh(this.b), Math.cos(this.a) * Math.sinh(this.b), this.c);
   }

   public zme g() {
      if (this.c.length() == 0) {
         this.c = "i";
      }

      double var1 = Math.cos(this.a) * Math.cosh(this.b);
      double var3 = -(Math.sin(this.a) * Math.sinh(this.b));
      return new zme(var1, var3, this.c);
   }

   public zme a(double var1) {
      if (this.c.length() == 0) {
         this.c = "i";
      }

      double var3 = Math.sqrt(this.a * this.a + this.b * this.b);
      double var5 = Math.atan2(this.b, this.a);
      double var7 = Math.pow(var3, var1) * Math.cos(var1 * var5);
      double var9 = Math.pow(var3, var1) * Math.sin(var1 * var5);
      return new zme(var7, var9, this.c);
   }

   public zme h() {
      if (this.c.length() == 0) {
         this.c = "i";
      }

      double var1 = Math.pow(2.718281828459045D, this.a) * Math.cos(this.b);
      double var3 = Math.pow(2.718281828459045D, this.a) * Math.sin(this.b);
      return new zme(var1, var3, this.c);
   }

   public double i() {
      double var1 = Math.atan2(this.b, this.a);
      return var1;
   }

   public zme j() {
      return new zme(this.a, -this.b, this.c);
   }
}
